Skip to content

perf: improve CLI startup speed and local build speed - #2279

Open
devxdh wants to merge 5 commits into
asyncapi:masterfrom
devxdh:improve-cli-performance
Open

devxdh wants to merge 5 commits into
asyncapi:masterfrom
devxdh:improve-cli-performance

Conversation

@devxdh

@devxdh devxdh commented Aug 10, 2026 •

Copy link
Copy Markdown

Hello!

Since I hadn't gotten feedback on #2269 yet, I've opened the pr to showcase the startup speed improvements, along with a couple of quick build speed optimizations I found while working on it.

What's in this PR:

  1. CLI Startup Speed (Lazy Loading)

    • Converted the top-level @asyncapi/parser import in src/apps/cli/internal/base.ts to import type and added a lazy getter/loader. Now, running basic commands doesn't parse @asyncapi/parser right away.
    • Deferred loading ValidationService, ValidationStatus, and ConversionService in validate.ts and convert.ts until run() or diagnostic handlers execute.
  2. Local Build Speed (tsc --incremental)

    • Added "incremental": true and "tsBuildInfoFile": "./.tsbuildinfo" to tsconfig.json (and added .tsbuildinfo to .gitignore). This caches AST metadata so tsc doesn't re-compile all ~200 files from scratch on minor edits.
  3. Skipping Example ZIP Downloads on Build

    • Updated scripts/fetch-asyncapi-example.js to check if assets/examples/examples.json already exists locally before fetching the 2MB zip from GitHub. I also added a FORCE_FETCH_EXAMPLES=true environment flag in case anyone wants to force a fresh download.

Benchmarks (Tested on my machine)

  • Local Build (npm run build): Dropped from ~19.75s down to ~6.15s (saving ~13.6 seconds per build).
  • CLI Startup (time ./bin/run_bin config): Dropped from ~2.37s down to ~1.76s.
  • Test Suite: All 382 tests passing cleanly.

Question for Maintainers

Does skipping the spec example download when examples.json already exists locally look okay to you, or would you prefer a different flag/approach for fetching examples during builds?

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud

Copy link
Copy Markdown

@devxdh
devxdh marked this pull request as ready for review August 10, 2026 13:31
@devxdh
devxdh marked this pull request as draft August 10, 2026 13:32
@devxdh

devxdh commented Aug 11, 2026

Copy link
Copy Markdown
Author

@Souvikns @Shurtu-gal Please have a look.

@AayushSaini101

Copy link
Copy Markdown
Collaborator

@neoandmatrix can you please take a look on this thanks

@devxdh

devxdh commented Aug 15, 2026 •

Copy link
Copy Markdown
Author

@neoandmatrix ping pong!

@neoandmatrix

Copy link
Copy Markdown
Contributor

@neoandmatrix ping pong!

Finalizing some PRs. Will review shortly.

@devxdh

devxdh commented Aug 21, 2026 •

Copy link
Copy Markdown
Author

@neoandmatrix ping pong!

@devxdh

devxdh commented Aug 25, 2026

Copy link
Copy Markdown
Author

@neoandmatrix hey any updates?

@devxdh

devxdh commented Aug 27, 2026

Copy link
Copy Markdown
Author

Okay, the review of this PR is taking too long. So I'm making it ready for review right away. I will be instantly available for follow-ups and requested changes.

@devxdh
devxdh marked this pull request as ready for review August 27, 2026 03:54
@devxdh

devxdh commented Aug 31, 2026

Copy link
Copy Markdown
Author

@princerajpoot20 @neoandmatrix Just bumping it in your inbox.

@princerajpoot20

Copy link
Copy Markdown
Member

@devxdh I need to review the issue first and will then check this PR. I’m currently OOO and will check this early next week.

@devxdh

devxdh commented Aug 31, 2026 •

Copy link
Copy Markdown
Author

@princerajpoot20 Sure thanks.

@devxdh

devxdh commented Sep 14, 2026

Copy link
Copy Markdown
Author

@neoandmatrix Hey any updates?

@princerajpoot20

Copy link
Copy Markdown
Member

Please be patient. Will look into it. We need some time. Everyone is occupied with something

@devxdh

devxdh commented Sep 14, 2026

Copy link
Copy Markdown
Author

@princerajpoot20 I understand

@changeset-bot

changeset-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 341afb2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud

Copy link
Copy Markdown

@devxdh

devxdh commented Nov 12, 2026 •

Copy link
Copy Markdown
Author

hey @AayushSaini101 @princerajpoot20 please look into this when you have a moment and let me know if there are any adjustments needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

4 participants